import request from '@/config/axios';
import { baseUrl } from '@/config/env';

export const loginByUsername = (username, password, code, redomStr) => request({
  url: baseUrl+'/sys/user/login',
  method: 'post',
  meta: {
    isToken: false,
    isSerialize:true,
  },
  data: {
    username,
    password,
    code,
    redomStr
  }
})

export const logout = () => request({
  url: baseUrl+'/sys/user/logout',
  meta: {
    isToken: false
  },
  method: 'get'
})

export const getUserInfo = () => request({
  url: baseUrl+'/sys/user/info',
  method: 'get'
});








export function fetchList(query) {
  return request({
    url: baseUrl+'/sys/user/page',
    method: 'get',
    params: query
  })
}

export function getObj(id) {
  return request({
    url: baseUrl+'/sys/user/' + id,
    method: 'get'
  })
}

export function addObj(obj) {
  return request({
    url: baseUrl+'/sys/user',
    method: 'post',
    data: obj
  })
}

export function putObj(obj) {
  return request({
    url: baseUrl+'/sys/user',
    method: 'put',
    data: obj
  })
}

export function delObj(id) {
  return request({
    url: baseUrl+'/sys/user/' + id,
    method: 'delete'
  })
}

export function resetPassword(id){
  return request({
    url:baseUrl+'/sys/user/reset/'+id,
    method:'put'
  });
}






